/*
 * Sched.cpp
 *
 *  Created on: 05-08-2011
 *      Author: cristian
 */

#include "Sched.h"

Sched::Sched() {
	this->logger = new Logger();

}

void Sched::createWorker(std::string nombre, std::string descripcion) {

	//Worker* w = new Worker(nombre, descripcion);
	//workers.push_back(w);

}

Sched::~Sched() {

	this->workers.clear();
	delete logger;

}

void Sched::trace() {
	list<Worker*>::iterator pos;
	pos = this->workers.begin();

	while (pos != workers.end()) {
		((*pos))->trace();
		pos++;
	}
}

//
//void Sched::createWorkerAndRun(std::string nombre, std::string descripcion) {
//
//	Worker* w = new Worker(nombre, descripcion);
//	workers.push_front(w);
//
//	list<Worker*>::iterator pos;
//	pos = this->workers.begin();
//
//	(*pos)->trace();
//
//	int rc = pthread_create((*pos)->getThread(), (*pos)->getAttr(), Worker::start, (*pos));
//
//	if (rc) {
//		/*
//		 * @TODO Log para los errores.
//		 */
//	}
//
//}

void Sched::printSize() {

#ifdef TRACE
	HAL_TRACE(logger, "Cantidad de Workers : %i", this->workers.size());
#endif
}

